'use strict'

define([ 'jquery', 'bootstrap', 'select2', 'shiftform', 'validate', 'validate.en'], function($) {
  return {
    init : function() {
      this.initPage();
      this.clickCommentBtn();
    },
    
    initPage : function() {
      $(".ihg-container").scroll(function() {
        $(".evaluation-layout").css("top",$(this).scrollTop())
      })
    },
    
    clickCommentBtn: function() {
      var that = this;
      $(document).on("click", ".select-comment", function(e) {
        that.currentElement = $(e.currentTarget).parent("td").data("comment");
        $(".comments-layout .main").show();
      })
      
      $(document).on("click", ".comments-item", function(e) {
        $(this).parents(".comments-layout .main").hide();
        $("td[data-comment='"+ that.currentElement +"']").find("a").hide();
        $("td[data-comment='"+ that.currentElement +"']").append($(this).html());
      })
    }

  }
})
